package com.aaa.mks.controller;

import com.aaa.common.util.Result;
import com.aaa.mks.entity.CouponHistory;
import com.aaa.mks.service.CouponHistoryService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * (CouponHistory)表控制层
 *
 * @author makejava
 * @since 2020-11-21 14:22:02
 */
@RestController
@RequestMapping("couponHistory")
public class CouponHistoryController {
    /**
     * 服务对象
     */
    @Resource
    private CouponHistoryService couponHistoryService;


    /**
     * 根据相关条件查询下单用户可用优惠券
     * @param map
     * @return
     */
    @PostMapping("queryAllByParam")
    public Result queryAllByParam(@RequestBody Map map) {
        System.out.println("到这了");
        System.out.println(map);
        return couponHistoryService.queryAllByParam(map);
    }
    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public CouponHistory selectOne(Long id) {
        return this.couponHistoryService.queryById(id);
    }
    /**
     * 修改数据
     *
     * @param couponHistory 实例对象
     * @return 实例对象
     */
    @PutMapping("update")
    public CouponHistory update(@RequestBody CouponHistory couponHistory) {
        return this.couponHistoryService.update(couponHistory);
    }

}